<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div id="app">

      <h1>{{xiaoxi}}</h1>
      <button @click="change">改变消息</button>
    </div>
  </body>
  <script src="./vue.js"></script>
  <script>
    let vm = new Vue({
      el: "#app",
      data: {
        xiaoxi: "BBB",
      },
      // watch 属性
      watch:{
        xiaoxi:function(){
          console.log("消息改变");
        }
      },
      methods: {
        change:function(){
            this.xiaoxi = "啊啊啊";
        }
      },
    });
  </script>
</html>
